import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import Element from 'element-ui'
import axios from 'axios'
import 'element-ui/lib/theme-chalk/index.css'
import './assets/css/global.css'
import "./assets/css/iconfont.css";
import './assets/css/animate.css'
import md5 from 'js-md5'
import { VueJsonp } from 'vue-jsonp'
import dayjs from 'dayjs'
import 'dayjs/locale/zh-cn' // import locale



Vue.config.productionTip = false


Vue.use(Element)
Vue.use(VueJsonp)
Vue.prototype.$http = axios
Vue.prototype.$md5 = md5;
// Vue.prototype.$jsonp = VueJsonp

Vue.prototype.dayjs = dayjs


Vue.filter('dateFormatFilter', function (date, fmt) {
  if (!date) return '-'
  return dayjs(date).format(fmt)
})
Vue.filter('dataFormat', function (originVal) {
  const dt = new Date(originVal)
  const y = dt.getFullYear()
  const m = (dt.getMonth() + 1 + '').padStart(2, '0')
  const d = (dt.getDate() + '').padStart(2, '0')
  return `${y} 年 ${m} 月 ${d} 日`
})
Vue.filter('dataFormat2', function (originVal) {
  const dt = new Date(originVal)
  const y = dt.getFullYear()
  const m = (dt.getMonth() + 1 + '').padStart(2, '0')
  const d = (dt.getDate() + '').padStart(2, '0')
  return `${y}-${m}-${d}`
})
// 页面跳转后页面位于顶部
router.afterEach((to, from, next) => {
  window.scrollTo(0, 0);
})
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
